package com.sixteen.theGreat.commons.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
    public static Date getCurrentDateTime(){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String format = sdf.format(new Date());
        Date parse=null;
        try {
             parse= sdf.parse(format);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
        return parse;
    }

    public static Date getCurrentDate(){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        String format = sdf.format(new Date());
        Date parse=null;
        try {
             parse= sdf.parse(format);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
        return parse;
    }

    public static Date getCurrentTime(){
        SimpleDateFormat sdf=new SimpleDateFormat("hh:mm:ss");
        String format = sdf.format(new Date());
        Date parse=null;
        try {
             parse= sdf.parse(format);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
        return parse;
    }
}
